<template>
  <div class="hello">
    <h1>{{ msgTo }}</h1>
    
  </div>
</template>

<script>
import { toUnitWan } from '@charmander/number'
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  data() {
    return {
      msgTo : ''
    }
  },
  created() {
    this.msgTo = toUnitWan()
    // this.msgTo = this.toThousand(this.msgTo)
  },
  methods: {
    toThousand(arg) {
      let getAgr = arg;
      // null、undefined、''、不传
      if (!getAgr) {
        getAgr = 0;
      }
      // 非数字
      if (!Number.isNaN(getAgr)) {
        getAgr = 0;
      }
      const result = parseFloat(String(getAgr)).toLocaleString();
      return result;
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
